package cn.dglydrpy.study.j2ee.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.dglydrpy.study.j2ee.manage.dao.UserDAO;



public class DelUserServlet extends HttpServlet{
	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		UserDAO dao = new UserDAO();
		try{
			dao.deleteById(Integer.parseInt(request.getParameter("id").trim()));
			response.sendRedirect("listUser");
		} catch(Exception e){
			e.printStackTrace();
			request.setAttribute("msg", "系统繁忙，稍后再试！");
			request.getRequestDispatcher("error5.jsp").forward(request, response);
		}
	
	}
}
